/* 
 * Copyright [2018] [Alex/libo(liboms@hotmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.shell.model;

import java.util.Objects;

/** 
 * @title MyRealm.java  
 * @package com.hyts.shell.model  
 * @description TODO  
 * @see TODO
 * @author libo/Alex
 * @email liboms@hotmail.com/liboware@163.com  
 * @date 2018年5月17日 
 * @version V1.0 
 */
public class UserRealm {
	
	
	/* (非 Javadoc)
	 * <b>TODO(方法功能的描述)-  hashCode </b>
	 * <p>TODO(这里用一句话描述这个方法的作用)</p>
	 * @return
	 * @see java.lang.Object#hashCode()  
	 * @exception
	 */ 
	@Override
	public int hashCode() {
		String str = this.getIp()+this.getUserName()+this.getPassword();
		return Objects.hash(str);
	}

	/* (非 Javadoc)
	 * @param obj
	 * @return
	 * @see java.lang.Object#equals(java.lang.Object)  
	 * @exception
	 */ 
	@Override
	public boolean equals(Object obj) {
		String str = this.getIp()+this.getUserName()+this.getPassword();
		if(obj instanceof UserRealm) {
			UserRealm realm = (UserRealm)obj;
			return str.equals((this.getIp()+this.getUserName()+this.getPassword()).intern());
		}
		return false;
	}

	/**  
	 * <p>ip地址</p> 
	 * @fieldName ip
	 * @fieldType String
	 */ 
	private String ip;
	
	/**  
	 * <p>用户名</p> 
	 * @fieldName userName
	 * @fieldType String
	 */ 
	private String userName;
	
	/**  
	 * <p>密码</p> 
	 * @fieldName password
	 * @fieldType String
	 */ 
	private String password;
	
	/**  
	 * <p>端口</p> 
	 * @fieldName port
	 * @fieldType Integer
	 */ 
	private Integer port;

	/**  
	 * @name userName's getter method
	 * @param none
	 * @return userName
	 */
	public String getUserName() {
		return userName;
	}

	/**  
	 * @name userName's setter method
	 * @param userName
	 * @return void
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**  
	 * @name password's getter method
	 * @param none
	 * @return password
	 */
	public String getPassword() {
		return password;
	}

	/**  
	 * @name password's setter method
	 * @param password
	 * @return void
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**  
	 * @name port's getter method
	 * @param none
	 * @return port
	 */
	public Integer getPort() {
		return port;
	}

	/**  
	 * @name port's setter method
	 * @param port
	 * @return void
	 */
	public void setPort(Integer port) {
		this.port = port;
	}
	
	/**  
	 * @name ip's getter method
	 * @param none
	 * @return ip
	 */
	public String getIp() {
		return ip;
	}

	/**  
	 * @name ip's setter method
	 * @param ip
	 * @return void
	 */
	public void setIp(String ip) {
		this.ip = ip;
	}

	/**  
	 * @constructor：UserRealm  
	 * @param ip
	 * @param userName
	 * @param password  
	 */ 
	public UserRealm(String ip, String userName, String password) {
		super();
		this.ip = ip;
		this.userName = userName;
		this.password = password;
	}

	/**  
	 * @constructor：UserRealm  
	 * @param ip
	 * @param userName
	 * @param password
	 * @param port  
	 */ 
	public UserRealm(String ip, String userName, String password, Integer port) {
		super();
		this.ip = ip;
		this.userName = userName;
		this.password = password;
		this.port = port;
	}

}
